const Timestamp = new Date().getTime()
const baseURL = require("./src/config/global.js").baseURL

module.exports = {
  publicPath: "./",
  productionSourceMap: false,
  configureWebpack: {
    resolve: {
      alias: {
        config: "@/config",
        assets: "@/assets",
        common: "@/common",
        components: "@/components",
        network: "@/network",
        views: "@/views",
      },
    },
    output: {
      filename: `js/[name].${Timestamp}.js`,
      chunkFilename: `js/[name].${Timestamp}.js`,
    },
  },
  css: {
    loaderOptions: {
      less: {
        modifyVars: {
          "swipe-indicator-size": "8px",
        },
      },
    },
  },
  devServer: {
    port: 3006,
    proxy: {
      "/cliapi": {
        target: baseURL.developmentTarget,
        ws: false,
        changeOrigin: true,
        pathRewrite: {
          "^/cliapi": "",
        },
      },
    },
    disableHostCheck: true, // 解决natapp Invalid Host header问题
  },
}